<template>
<div class="login">
    用户名称：<input type="text" v-model="username"><br>
    密码：<input type="text" v-model="password"><br>
    <button @click="login">登陆</button>
</div>

</template>

<script>
export default {
    data () {
        return {
            username:'',
            password:''
        }
    },
    methods: {
        login(){
            if(this.username=='admin'&&this.password==123){
                localStorage.setItem('taken',this.username)
                this.$router.push({path:'/index'})
            }else{
                alert('你输入的账号或密码不正确')
            }
        }
    }

}
</script>
<style lang='less' scoped>

</style>
